package com.fastloan.jn.mgt.customer.controller;

import com.fastloan.jn.mgt.customer.model.JnCustomerTransition;
import com.fastloan.jn.mgt.customer.service.JnCustomerTransitionService;
import com.kawins.base.baseabs.BaseController;
import com.kawins.result.ResultTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author chenkai
 *         createTime 2017-10-2017/10/18 9:44
 */
@RestController
@RequestMapping("/api/web/transition")
public class JnCustomerTransitionController extends BaseController<JnCustomerTransition> {
    @Autowired
    private JnCustomerTransitionService transitionService;

    /**
     * 客户移交申请列表
     *
     * @return
     */
    @RequestMapping("/customerTransitionApply")
    public ResultTo customerTransitionApply() {
        return dataPage("customerTransitionApply");
    }

    /**
     * 客户移交审批列表
     *
     * @return
     */
    @RequestMapping("/customerTransitionApprove")
    public ResultTo customerTransitionApprove() {
        return dataPage("customerTransitionApprove");
    }


    /**
     * 客户移交申请
     *
     * @param customerTransition
     * @return
     */
    @PostMapping
    public ResultTo apply(JnCustomerTransition customerTransition) {
        return transitionService.apply(customerTransition);
    }

    /**
     * 审批通过
     *
     * @param customerId
     * @return
     */
    @PutMapping("/{customerId}/pass")
    public ResultTo pass(@PathVariable String customerId) {
        return transitionService.pass(customerId);
    }

    /**
     * 审批拒绝
     *
     * @param customerId
     * @return
     */
    @PutMapping("/{customerId}/reject")
    public ResultTo reject(@PathVariable String customerId) {
        return transitionService.reject(customerId);
    }

}
